package com.ice.remoting.exception;

import com.ice.framework.common.constant.IResultCode;

public enum ServerErrorCode implements IResultCode {
    PAIR_NOT_REGISTER("301", "命令没有注册执行器或者没有默认执行器"),
    HANDLE_EXECUTE_ERROR("302","执行器执行任务失败"),

    ;

    private String code;
    private String message;

    private ServerErrorCode(String message) {
        this.message = message;
    }

    private ServerErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String getCode() {
        return this.code == null ? this.name().substring(1) : this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

    public boolean equals(String errorCode) {
        return this.code.equals(errorCode);
    }
}